home *** CD-ROM | disk | FTP | other *** search
/ Collection of Tools & Utilities / Collection of Tools and Utilities.iso / asmutil / asm_n_z.zip / SETUP.ASM < prev    next >
Assembly Source File  |  1986-04-15  |  28KB  |  569 lines

  1. ;
  2. interrupts    segment at 0h                      ;interrupt table segment
  3.               org 9h*4
  4. keyboard_int  dw 2 dup (?)                       ;interrupt 9 vector
  5. interrupts    ends
  6. ;
  7. rom_bios_data segment at 40h                     ;ROM BIOS data area segment
  8.               org 60h
  9. ;
  10. cursor_mode   dw ?            ;starting and ending cursor scan lines
  11. rom_bios_data ends
  12. ;
  13. rom           segment at 0F000h                  ;ROM segment
  14.               org 0FFFEh
  15. ;
  16. machine_id    db ?                ;ID byte identifies machine as PCjr or other
  17. rom           ends
  18. ;
  19. code          segment para public 'code'         ;code segment
  20.               assume cs:code
  21.               org 100h
  22. ;
  23. begin:        jmp initialize                     ;goto initialization routine
  24. ;
  25.               db '(C) Copyright 1986, Ziff-Davis Publishing Company ', 1Ah
  26. ;
  27. column_count  dw ?                               ;width of window in columns
  28. cursor_type   dw ?                               ;cursor scan line definition
  29. setup_status  db 0          ;indicates if printer window is already active
  30. display_mode  dw ?                               ;current crt display mode
  31. page_no       dw ?                               ;current displayed page
  32. attribute1    db 4Fh                             ;window attribute bytes
  33. attribute2    db 70h
  34. ;
  35. display_table db 2Dh,29h    ;display re-enable values for modes 2 and 3
  36. video         dw 0B800h,0B900h,0BA00h,0BB00h     ;starting addresses of video
  37.                                                  ;memory for CGA pages 0 - 3
  38. ;
  39. mono_video    dw 0B000h                          ;video segment address for
  40.                          ;monochrome adapter
  41. ;
  42. old_kb_int              label dword
  43. old_keyboard_int        dw 2 dup (?)             ;storage for old keyboard
  44.                          ;interrupt vector
  45. ;
  46. ;----------------------------------------------------------------------------
  47. ;Text of the Printer Setup Menu window.
  48. ;After initialization, text and attribute bytes are combined and stored
  49. ;in the WINDOW_TEXT area, and this area is used to store the contents of
  50. ;the screen that underlie the window when the window is called up.
  51. ;----------------------------------------------------------------------------
  52. ;
  53. window_buffer           label word
  54. buffer_text             db 201,26 dup (205),187
  55.                         db 186,'    PRINTER SETUP MENU    ',186
  56.                         db 186,'   EPSON RX/FX PRINTERS   ',186
  57.                         db 199,26 dup (196),182
  58.                         db 186,' F1    Compressed Mode    ',186
  59.                         db 186,' F2    Expanded Mode      ',186
  60.                         db 186,' F3    Emphasized Mode    ',186
  61.                         db 186,' F4    Double-Strike Mode ',186
  62.                         db 186,' F5    Elite Mode         ',186
  63.                         db 186,' F6    Miniature Mode     ',186
  64.                         db 186,' F7    Skip Perforation   ',186
  65.                         db 186,' F8    Indent Left Margin ',186
  66.                         db 186,' F9    Reset Top-of-Form  ',186
  67.                         db 186,' F10   Reset Print Modes  ',186
  68.                         db 186,' ESC   Exit               ',186
  69.                         db 199,26 dup (196),182
  70.                         db 186,' Unshifted:   Toggle ON   ',186
  71.                         db 186,' Shifted:     Toggle OFF  ',186
  72.                         db 200,26 dup (205),188
  73.                         db 532 dup (?)
  74. ;
  75. ;Storage area for the combination of text and attribute bytes that
  76. ;form the window image.
  77. ;
  78. window_bytes  label byte
  79. window_text   dw 532 dup (?)
  80. ;
  81. ;Control code strings for all of the printer setup options.
  82. ;
  83. code_table:   db 15,255,14 dup (0)            ;compressed mode on
  84.               db 27,87,1,255,12 dup (0)                 ;expanded mode on
  85.               db 27,69,255,13 dup (0)                   ;emphasized mode on
  86.               db 27,71,255,13 dup (0)                   ;double-strike mode on
  87.               db 27,77,255,13 dup (0)                   ;elite mode on
  88.               db 15,27,83,0,27,65,6,255,8 dup (0)       ;miniature mode on
  89.               db 27,78,12,255,12 dup (0)                ;perfskip on
  90.               db 27,108,10,255,12 dup (0)               ;indent left margin
  91.               db 27,67,66,255,12 dup (0)                ;reset top-of-form
  92.               db 18,27,87,0,27,70,27,72,27,80,27,84,27,50,255,0      ;reset
  93.                                                                ;print modes
  94. ;
  95.               db 18,255,14 dup (0)                      ;compress off
  96.               db 27,87,0,255,12 dup (0)                 ;expand off
  97.               db 27,70,255,13 dup (0)                   ;emphasize off
  98.               db 27,72,255,13 dup (0)                   ;double-strike off
  99.               db 27,80,255,13 dup (0)                   ;elite off
  100.               db 18,27,84,27,50,255,10 dup (0)          ;miniature off
  101.               db 27,79,255,13 dup (0)                   ;perfskip off
  102.               db 27,108,0,255,12 dup (0)                ;indent off
  103. ;
  104. ;---------------------------------------------------------------------------
  105. ;Execution comes here, to the main body of the program, when an interrupt 9
  106. ;is generated from the keyboard.  Registers are saved, then the keypress is
  107. ;checked and compared to the key combination that activates the menu window.
  108. ;---------------------------------------------------------------------------
  109. ;
  110. main          proc near
  111.               sti                                ;enable software interrupts
  112.               push ax                            ;save all registers
  113.               push bx
  114.               push cx
  115.               push dx
  116.               push si
  117.               push di
  118.               push ds
  119.               push es
  120.               push ax                ;save ax for call to old routine
  121.               in al,0A0h                         ;re-enable NMI on PCjr
  122.               pop ax                             ;restore ax
  123.               pushf          ;simulate interrupt call to old keyboard routine
  124.               call old_kb_int                    ;call old routine
  125.               mov ah,2                   ;check status of the shift keys
  126.               int 16h
  127.               and al,5                           ;Ctrl and Rt-Shift depressed?
  128.               cmp al,5
  129.               je do_program                      ;yes, then skip exit routine
  130. ;
  131. ;Exit routine is the common point of exit for all routines in the program.
  132. ;
  133. exit:         pop es
  134.               pop ds
  135.               pop di
  136.               pop si
  137.               pop dx
  138.               pop cx
  139.               pop bx
  140.               pop ax
  141.               iret
  142. ;
  143. ;Execution comes here when the proper key combination, Ctrl/Rt-Shift, is
  144. ;pressed.  First task is to check whether or not the window is already open.
  145. ;
  146. do_program:   push cs              ;set es and ds to the code segment
  147.               pop ds
  148.               push cs
  149.               pop es
  150.               cmp setup_status,0                 ;is the window already open?
  151.               jne exit                           ;yes, then ignore request
  152. ;
  153. ;----------------------------------------------------------------------------
  154. ;Check current video mode.  If it's mode 2, 3, or 7, then set the window
  155. ;status flag, store the mode number and page number, save the cursor type,
  156. ;and hide the cursor.  If any other display mode is active instead, ignore
  157. ;the request and exit.
  158. ;----------------------------------------------------------------------------
  159. ;
  160.               mov ah,15                          ;get page and mode numbers
  161.               int 10h                            ;al=mode, bh=page
  162.               cmp al,2                ;is crt now in an acceptable mode?
  163.               je prog0                           ;yes, then continue
  164.               cmp al,3
  165.               je prog0
  166.               cmp al,7
  167.               je prog0
  168.               jmp exit                           ;no, then ignore request
  169. prog0:        mov setup_status,1                 ;set status flag to indicate
  170.                                                  ;that window is active
  171.